home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
398
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
1KB
Path: solon.com!not-for-mail
From: diamond@tko.dec.com (Norman Diamond)
Newsgroups: comp.std.c,comp.lang.c.moderated
Subject: Re: Integral promotion.
Date: 15 Feb 1996 08:46:03 -0600
Organization: Digital Equipment Corporation Japan , Tokyo
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4fvgvb$e0t@solutions.solon.com>
References: <4fstj7$2l6@solutions.solon.com>
Reply-To: diamond@jrdv04.enet.dec-j.co.jp (Norman Diamond)
NNTP-Posting-Host: solutions.solon.com
In article <4fstj7$2l6@solutions.solon.com>, Rune Huseby <rune.huseby@gpi.telemax.no> writes:
>short test(short x1, short x2) {
> short result;
> result = x1 + x2; /* Warning: '=' : conversion from 'int '
> to 'short ', possible loss of data */
>My compiler [...] automagically converts my short-parameters to int's
No. The addition operator "+" converts your short operands to ints.
The standard added the ability to prototype functions and clarified what
would happen if parameters are declared with non-promoted types, and this
is obeyed here. It just happens to be irrelevant. The "+" operator
promoted its operands even in pre-standard days.
--
<< If this were the company's opinion, I would not be allowed to post it. >>
"I paid money for this car, I pay taxes for vehicle registration and a driver's
license, so I can drive in any lane I want, and no innocent victim gets to call
the cops just 'cause the lane's not goin' the same direction as me" - J Spammer